home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-Native.exe / {app} / include / elements / CEGUIGUISheet.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-07-10  |  5.0 KB  |  173 lines

  1. /************************************************************************
  2.     filename:   CEGUIGUISheet.h
  3.     created:    5/6/2004
  4.     author:     Paul D Turner
  5.  
  6.     purpose:    Interface to a default window
  7. *************************************************************************/
  8. /*************************************************************************
  9.     Crazy Eddie's GUI System (http://www.cegui.org.uk)
  10.     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  11.  
  12.     This library is free software; you can redistribute it and/or
  13.     modify it under the terms of the GNU Lesser General Public
  14.     License as published by the Free Software Foundation; either
  15.     version 2.1 of the License, or (at your option) any later version.
  16.  
  17.     This library is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20.     Lesser General Public License for more details.
  21.  
  22.     You should have received a copy of the GNU Lesser General Public
  23.     License along with this library; if not, write to the Free Software
  24.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25. *************************************************************************/
  26. #ifndef _CEGUIGUISheet_h_
  27. #define _CEGUIGUISheet_h_
  28.  
  29. #include "CEGUIWindow.h"
  30. #include "CEGUIWindowFactory.h"
  31.  
  32.  
  33. // Start of CEGUI namespace section
  34. namespace CEGUI
  35. {
  36. /*!
  37. \brief
  38.     Window class intended to be used as a simple, generic Window.
  39.  
  40.     This class does no rendering and so appears totally transparent.  This window defaults
  41.     to position 0.0f, 0.0f with a size of 1.0f x 1.0f.
  42.  
  43.     /note
  44.     The C++ name of this class has been retained for backward compatibility reasons.  The intended usage of
  45.     this window type has now been extended beyond that of a gui-sheet or root window.
  46. */
  47. class CEGUIEXPORT GUISheet : public Window
  48. {
  49. public:
  50.     /*************************************************************************
  51.         Constants
  52.     *************************************************************************/
  53.     // type name for this widget
  54.     static const String WidgetTypeName;             //!< The unique typename of this widget
  55.  
  56.  
  57.     /*************************************************************************
  58.         Construction and Destruction
  59.     *************************************************************************/
  60.     /*!
  61.     \brief
  62.         Constructor for GUISheet windows.
  63.     */
  64.     GUISheet(const String& type, const String& name) : Window(type, name) {}
  65.  
  66.  
  67.     /*!
  68.     \brief
  69.         Destructor for GUISheet windows.
  70.     */
  71.     virtual ~GUISheet(void) {}
  72.  
  73.  
  74. protected:
  75.     /*!
  76.     \brief
  77.         Perform the actual rendering for this Window.
  78.  
  79.     \param z
  80.         float value specifying the base Z co-ordinate that should be used when rendering
  81.  
  82.     \return
  83.         Nothing
  84.     */
  85.     virtual void    drawSelf(float z) {}
  86.  
  87.  
  88.     /*!
  89.     \brief
  90.         overridden initialise member to set-up our default state.
  91.     */
  92.     void initialise(void)
  93.     {
  94.         Window::initialise();
  95.  
  96.         setMaximumSize(Size(1.0f, 1.0f));
  97.         setSize(Size(1.0f, 1.0f));
  98.     }
  99.  
  100.  
  101.     /*!
  102.     \brief
  103.         Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
  104.  
  105.     \param class_name
  106.         The class name that is to be checked.
  107.  
  108.     \return
  109.         true if this window was inherited from \a class_name. false if not.
  110.     */
  111.     virtual bool    testClassName_impl(const String& class_name) const
  112.     {
  113.         if (class_name==(const utf8*)"GUISheet")    return true;
  114.         return Window::testClassName_impl(class_name);
  115.     }
  116. };
  117.  
  118.  
  119. /*!
  120. \brief
  121.     Factory class for producing default windows
  122. */
  123. class GUISheetFactory : public WindowFactory
  124. {
  125. public:
  126.     /*************************************************************************
  127.         Construction and Destruction
  128.     *************************************************************************/
  129.     GUISheetFactory(void) : WindowFactory(GUISheet::WidgetTypeName) { }
  130.     ~GUISheetFactory(void){}
  131.  
  132.  
  133.     /*!
  134.     \brief
  135.         Create a new Window object of whatever type this WindowFactory produces.
  136.  
  137.     \param name
  138.         A unique name that is to be assigned to the newly created Window object
  139.  
  140.     \return
  141.         Pointer to the new Window object.
  142.     */
  143.     Window* createWindow(const String& name)
  144.     {
  145.         return new GUISheet(d_type, name);
  146.     }
  147.  
  148.  
  149.     /*!
  150.     \brief
  151.         Destroys the given Window object.
  152.  
  153.     \param window
  154.         Pointer to the Window object to be destroyed.
  155.  
  156.     \return
  157.         Nothing.
  158.     */
  159.     virtual void    destroyWindow(Window* window)    { if (window->getType() == d_type) delete window; }
  160. };
  161.  
  162. /*!
  163. \brief
  164.     typedef for DefaultWindow, which is the new name for GUISheet.
  165. */
  166. typedef GUISheet DefaultWindow;
  167.  
  168.  
  169. } // End of  CEGUI namespace section
  170.  
  171.  
  172. #endif  // end of guard _CEGUIGUISheet_h_
  173.